package com.netcombine.freewill.controller;

import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.netcombine.freewill.constants.PageInfo;
import com.netcombine.freewill.manager.SessionManager;

@Controller
public class BoardController{

	private static final Logger logger = LoggerFactory.getLogger(BoardController.class);

	@RequestMapping(value = "/board/list")
	public String board_list(HttpSession session, Model model){

		if(SessionManager.isLogin(session)){
			
			model.addAttribute(PageInfo.CURRENT_MENU, PageInfo.MENU_BOARD);

			return "board/list";
		}
		else{

			return PageInfo.GO_LOGIN;
		}
		
	}
	@RequestMapping(value = "/board/noticelist")
	public String notice_board_list(HttpSession session, Model model){
		
		if(SessionManager.isLogin(session)){
			
			model.addAttribute(PageInfo.CURRENT_MENU, PageInfo.MENU_NOTICE);

			return "board/noticelist";
		}
		else{

			return PageInfo.GO_LOGIN;
		}
		
	}
	@RequestMapping(value = "/board/helplist")
	public String help_board_list(HttpSession session, Model model){
		
		if(SessionManager.isLogin(session)){
			
			model.addAttribute(PageInfo.CURRENT_MENU, PageInfo.MENU_HELP);

			return "board/helplist";
		}
		else{

			return PageInfo.GO_LOGIN;
		}
	}
	@RequestMapping(value = "/board/userlist")
	public String user_board_list(HttpSession session, Model model){
		if(SessionManager.isLogin(session)){
			
			model.addAttribute(PageInfo.CURRENT_MENU, PageInfo.MENU_USER_BOARD);

			return "board/userlist";
		}
		else{

			return PageInfo.GO_LOGIN;
		}
	}
}